package engine.newUi
{
	import engine.scene.SceneChangeManager;
	import engine.ui.lite.BaseUI;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	import newx.StageInfo;
	import newx.com.control.button.NxButton;
	import newx.com.control.text.NxLabel;
	import newx.com.control.text.NxText;

	/**
	 *帮派战 战场界面 
	 * @author liuel
	 * 
	 */	
	public class FactionAttackUI extends BaseUI
	{
		private static var _self 			:FactionAttackUI;
		public var leftMC					:MovieClip;
		public var rightMC					:MovieClip;
		
		public var mc1						:MovieClip;
		public var mc2						:MovieClip;

		public var warMC					:MovieClip;
		
		public var leftLabel				:NxLabel;
		public var rightLabel				:NxLabel;
		
		public var timeLabel				:NxLabel;
		public var warText					:NxText;
		public var exitBtn					:NxButton;
		
		private var _sprite1				:Sprite;
		private var _sprite2				:Sprite;
		private var _sprite3				:Sprite;
		private var _sprite4				:Sprite;
		private var _sprite5				:Sprite;
		public function FactionAttackUI(popupUI:Boolean=true)
		{
			super(popupUI);
		}
		public static function getInstance():FactionAttackUI
		{
			if(_self == null)
			{
				_self = new FactionAttackUI();
			}
			return _self;
		}
		override public function Init() : void
		{
			
			FactionAttackLogic.getInstance().Init();
			setUI();
		}
		override protected function	BeforeShow():void
		{
			FactionAttackLogic.getInstance().BeforeShow();
		}
		override protected function	AfterHide():void
		{
			FactionAttackLogic.getInstance().AfterHide();
		}
		private function setUI():void
		{
			_sprite1 = new Sprite();  //left帮派信息容器
			_sprite2 = new Sprite();  //right帮派信息容器
			_sprite3 = new Sprite();  //时间容器
			_sprite4 = new Sprite();  //战报容器
			_sprite5 = new Sprite(); //退出按钮容器
			
			_sprite1.addChild(mc1); 
			_sprite1.addChild(leftMC);
			_sprite1.addChild(leftLabel);
			
			_sprite2.addChild(mc2);
			_sprite2.addChild(rightMC);
			_sprite2.addChild(rightLabel);
			
			_sprite3.addChild(timeLabel);
			
			_sprite4.addChild(warMC);
			_sprite4.addChild(warText);
			
			_sprite5.addChild(exitBtn);
			
			this.addChild(_sprite1);
			this.addChild(_sprite2);
			this.addChild(_sprite3);
			this.addChild(_sprite4);
			this.addChild(_sprite5);
			resUI();
			
		}
		public function resUI():void
		{
			_sprite1.x =SceneChangeManager.getGameMinWidhtOffsize()+20;
			
			_sprite2.x =SceneChangeManager.getGameWidth()-warMC.width-400+SceneChangeManager.getGameMinWidhtOffsize();
			
			_sprite3.x =(_sprite1.x+_sprite2.x)*0.5-450-exitBtn.width*0.25;
			
			_sprite4.x =SceneChangeManager.getGameWidth()-warMC.width+SceneChangeManager.getGameMinWidhtOffsize()-10;
			_sprite4.y =SceneChangeManager.getGameHeight()+SceneChangeManager.getGameMinHeightOffsize()-warMC.width-200;
			
			_sprite5.x =_sprite3.x+30;
			_sprite5.y =SceneChangeManager.getGameHeight()+SceneChangeManager.getGameMinHeightOffsize()-150;
		}

	}
}